import json

import requests


headers = {
    "Accept": "application/json, text/javascript, */*; q=0.01",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Connection": "keep-alive",
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    "Origin": "https://sxggzyjy.xa.gov.cn",
    "Referer": "https://sxggzyjy.xa.gov.cn/jydt/001001/001001001/001001001007/2.html",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
    "X-Requested-With": "XMLHttpRequest",
    "sec-ch-ua": "\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\""
}
cookies = {
    "JSESSIONID": "0F22AEF40ADBACFC4ECDB58F63D01B67",
    "yfx_c_g_u_id_10007920": "_ck23103109234012533852073953634",
    "yfx_f_l_v_t_10007920": "f_t_1698715420251__r_t_1698715420251__v_t_1698717530443__r_c_0"
}
url = "https://sxggzyjy.xa.gov.cn/epointjweb/zcfgSearch.action"
params = {
    "cmd": "getList"
}
data = {
    "siteGuid": "e5147ab7-49e4-4b7c-a311-5d221f66bac6",
    "title": "",
    "categorynum": "001001001007",
    "pageIndex": 1,
    "pageSize": "10"
}
response = requests.post(url, headers=headers, cookies=cookies, params=params, data=data)
response = response.json()


a = response['custom']
print(a)
print(type(a))
c = json.loads(a)
d = c['Table'][0]
z = d.get('infoid')
print(c)
print(type(c))
print(d)
print(type(d))
print(z)

